package test;

import java.util.List;

import javax.annotation.Resource;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import com.alibaba.fastjson.JSONObject;
import com.hpdf.domain.TbDCarinfo;
import com.hpdf.domain.param.TbDCarinfoRequest;
import com.hpdf.service.DomeService;
import com.hpdf.utils.web.resultbean.BizResult;
import com.hpdf.utils.web.resultbean.PageBean;
import com.hpjz.basicofing.service.IUserService;
import com.hpjz.basicofing.web.vo.UserVO;
@RunWith(SpringJUnit4ClassRunner.class)  
@ContextConfiguration(locations = { "classpath:applicationContext.xml" })  
public class tese {
	
	@Autowired
	private  DomeService domeService;
	
	@Resource
	private IUserService userService;
	/**
	 * 查询车辆信息表.<br/>
	 * @throws Exception 
	 */
//	@Test
	public void queryCarinfo() throws Exception{
		TbDCarinfo carinfo = new TbDCarinfo();
		carinfo.setCarid(15);
		BizResult<TbDCarinfo> result = domeService.queryCarinfo(carinfo);
		System.out.println(result.toString());
	}
//	@Test
	public void test(){
		List<UserVO> list = userService.findAllUsers();
		System.out.println(JSONObject.toJSON(list));
	}
//	@Test
	public void queryCarinfoForPage() throws Exception{
		TbDCarinfoRequest tbDCarinfoRequest = new TbDCarinfoRequest();
		tbDCarinfoRequest.setPageNum(1);
		tbDCarinfoRequest.setPageSize(2);
		BizResult<PageBean<TbDCarinfo>> result = domeService.queryCarinfoForPage(tbDCarinfoRequest);
	    if(result.isSuccess() ){
	    	System.out.println(JSONObject.toJSON(result));
	    }
	}
	
	@Test
	public void insertInCarinfo() {
		TbDCarinfo tb = new TbDCarinfo();
		
		tb.setCarlicensplate("2");
		tb.setStatus("1");
		
		int i = domeService.insertInCarinfo(tb);
	}
	
	
}
